<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://www.ufida.com/lfw" prefix="lfw" %>
<%@ taglib uri="http://www.ufida.com/uif" prefix="uif" %> 
<%@ taglib uri="http://www.ufida.com/lfwtool" prefix="lfwtool" %> 
<%@ taglib uri="http://www.ufida.com/multilang" prefix="ml" %> 
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<html>
	<head>
		<lfw:base/>
		<lfw:head/>
		<uif:import type="2"/>
		<script type='text/javascript' src='<%= "code/" + request.getParameter("pageId") %>'></script>
		<script>
			<%@ include file="include.jsp"%>
		</script>
		<style>
			#bodyContainer{
				width:100%;
				height:100%;
				margin-left:10px;
				margin-right:10px;
				padding-bottom:10px;
				overflow:hidden;
			}
		</style>
	</head>
	<body bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0" scroll=no onload="pageBodyScript()" style="background:#c6cee3">
		<lfw:pageModel className="nc.lfw.finance.model.BxContrastPageModel">
			<lfw:layout type="border">
				<lfw:layoutPanel position="center">
					<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
						<tr height="10px">
							<td>
								<div style="background:url('/lfw/frame/themes/ncclassic/images/tabs/seperator_bg.gif');height:10px;width:100%;"></div>
							</td>
						</tr>
						<tr height="40px">
							<td>
								<lfw:layout type="flowh">
									<lfw:layoutPanel width="630">
										<lfw:form id="cjk_query_form"></lfw:form>
									</lfw:layoutPanel>
									<lfw:layoutPanel width="70">
										<lfw:button id="cjk_query"></lfw:button>
									</lfw:layoutPanel>
								</lfw:layout>
							</td>
						</tr>
						<tr>
							<td>
								<div id="bodyContainer">
									<lfw:tab id="headTab">
										<c:forEach var="item" items="${headTab.itemList}">
											<lfw:tabitem id="${item.id}">
												<lfw:grid id="headTab_${item.id}_grid" />
											</lfw:tabitem>
										</c:forEach>
									</lfw:tab>
								</div>
							</td>
						</tr>
					</table>	
				</lfw:layoutPanel>
				<lfw:layoutPanel position="bottom" height="30">
					<lfw:layout type="flowh">
						<lfw:layoutPanel>
							<lfw:button id="confirmBtn"></lfw:button>
						</lfw:layoutPanel>
						<lfw:layoutPanel>
							<lfw:button id="cancelBtn"></lfw:button>
						</lfw:layoutPanel>
					</lfw:layout>
				</lfw:layoutPanel>
			</lfw:layout>
		</lfw:pageModel>
	</body>
</html>
<script>
	function JkbxJeRender(){};
	JkbxJeRender.render = function(rowIndex, colIndex, value, header, cell)
	{
		if(value == null)
			return;
		cell.style.overflow = "hidden";
		cell.style.textOverflow = "ellipsis";
		cell.style.cursor = "default";
		cell.style.textAlign = "center";
		
		var grid = header.owner;
		var ds = grid.model.dataset;
		var gridRow = grid.getRow(rowIndex);
		var row = gridRow.getRowData();
		
		var pre = 2;
		if(parent.window.bzbmmap != null){
			pre = parent.window.bzbmmap.get(ds.getRow(rowIndex).getCellValue(ds.nameToIndex('bzbm')));
		}
		var digit = parseFloat(value);
		value = (digit * Math.pow(10, pre) / Math.pow(10, pre)).toFixed(pre);
		
		value = value + "";
		if(value.indexOf(".") == -1){
			value += "."
			for(var i=0; i<pre; i++)
				value += "0";
		}else if(parseFloat(value) == 0){//值为0
			value = "0."
			for(var i=0; i<pre; i++)
				value += "0";
		}else{//正常浮点数
			value = getDoubleByTrimZero(value);
			if(value.indexOf(".") == -1){
				value += "."
				for(var i=0; i<pre; i++)
					value += "0";
			}else{
				var arr = value.split(".");
				var c = pre - parseInt(arr[1].length);
				if(c > 0){
					for(var i=0; i<c; i++)
						value += "0";				
				}
			}
		}
		cell.innerHTML  = "<center>" + value + "<center>" ;
	};
	/*去掉0*/
	function getDoubleByTrimZero(value){
		var index = -1;
		var count = value.length-1;
		for(var i=count;i>=0;i--){
			var ch = value.charAt(i);
			if(ch == '.'){
				index = i;
				break;	
			}else if(ch != '0'){
				index = i+1;
				break;	
			}
		}
		return (index == -1) ? value : value.substring(0,index) ;
	}
</script>
